package com.yjkf.zh.core.utils;

import java.util.Random;

public class DeviceIdentUtil {
    public String getDeviceString(String deviceApi){
        StringBuffer stringBuffers = new StringBuffer();
        String az="ABCDEFGH0000000000000000000";
        String [] newApi = new String[18];
        newApi=deviceApi.split("");
        for(int i=0;i<deviceApi.length();i++){
            if(i<2){
                int a=az.indexOf(newApi[i])+1;
                newApi[i]=Integer.toString(a);
                stringBuffers.append(newApi[i]);
            }else{
                int pInt=Integer.parseInt(newApi[i])+3;
                newApi[i]=Integer.toString(pInt);
                if(newApi[i].length()==2){
                    newApi[i]=newApi[i].substring(1);
                }
                stringBuffers.append(newApi[i]);
            }
        }
        int y=deviceApi.length();
        int z=17-y;
        for(int i=0;i<z;i++){
            stringBuffers.append("0");
        }

        Random random = new Random();
        //   stringBuffers.append(dds);
        stringBuffers.append(random.nextInt(9));
        return stringBuffers.toString();
    }
}
